package com.simon.queue;

import redis.clients.jedis.Jedis;

import java.nio.channels.Pipe;
import java.util.Random;
import java.util.UUID;

/**
 * Created by changf on 2017/7/5.
 */
public class TaskProducer {


    public static Jedis getJedis(String address,int port){
        Jedis jedis=new Jedis(address,port);
        return jedis;
    }


    public static void main(String[] args)throws Exception {

        Jedis jedis = getJedis("192.168.112.12", 6379);

        Random random=new Random();
        while(true){
            Thread.sleep(random.nextInt(1000)+1000);

            String uuid= UUID.randomUUID().toString();
            Long taskId = jedis.lpush("task-queue", uuid);
            System.out.println("====put task-queue taskId:"+taskId+",data:"+uuid);

        }


    }


}
